﻿namespace GCC.Container.Abstracts
{
    /// <summary>
    /// 日志的扩展
    /// </summary>
    public static class AbsLoggerExtends
    {

        /// <summary>
        /// 记录追踪日志
        /// </summary>        
        /// <param name="instance">日志实例</param>
        /// <param name="text">文本</param>
        /// <param name="eventID">事件ID</param>
        /// <param name="exception">异常</param>
        public static void Trace(this AbsGCCLogger instance, string text, string? eventID = null, Exception? exception = null)
        {
            instance.Log(LogLevelEnum.Trace, text, eventID, exception);
        }

        /// <summary>
        /// 记录调试日志
        /// </summary>        
        /// <param name="instance">日志实例</param>
        /// <param name="text">文本</param>
        /// <param name="eventID">事件ID</param>
        /// <param name="exception">异常</param>
        public static void Debug(this AbsGCCLogger instance, string text, string? eventID = null, Exception? exception = null)
        {
            instance.Log(LogLevelEnum.Debug, text, eventID, exception);
        }

        /// <summary>
        /// 记录信息日志
        /// </summary>        
        /// <param name="instance">日志实例</param>
        /// <param name="text">文本</param>
        /// <param name="eventID">事件ID</param>
        /// <param name="exception">异常</param>
        public static void Information(this AbsGCCLogger instance, string text, string? eventID = null, Exception? exception = null)
        {
            instance.Log(LogLevelEnum.Information, text, eventID, exception);
        }

        /// <summary>
        /// 记录警告日志
        /// </summary>        
        /// <param name="instance">日志实例</param>
        /// <param name="text">文本</param>
        /// <param name="eventID">事件ID</param>
        /// <param name="exception">异常</param>
        public static void Warning(this AbsGCCLogger instance, string text, string? eventID = null, Exception? exception = null)
        {
            instance.Log(LogLevelEnum.Warning, text, eventID, exception);
        }

        /// <summary>
        /// 记录错误日志
        /// </summary>        
        /// <param name="instance">日志实例</param>
        /// <param name="text">文本</param>
        /// <param name="eventID">事件ID</param>
        /// <param name="exception">异常</param>
        public static void Error(this AbsGCCLogger instance, string text, string? eventID = null, Exception? exception = null)
        {
            instance.Log(LogLevelEnum.Error, text, eventID, exception);
        }


        /// <summary>
        /// 记录危险日志
        /// </summary>        
        /// <param name="instance">日志实例</param>
        /// <param name="text">文本</param>
        /// <param name="eventID">事件ID</param>
        /// <param name="exception">异常</param>
        public static void Critical(this AbsGCCLogger instance, string text, string? eventID = null, Exception? exception = null)
        {
            instance.Log(LogLevelEnum.Critical, text, eventID, exception);
        }

    }
}
